﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ScriptifyLibrary20;
using ScriptifyLibrary40;
using System.Windows.Forms;

namespace ScriptifyWinForms
{
    class WinFormProgressBar : IProgressBar
    {
        ToolStripProgressBar _bar;
        ToolStripStatusLabel _label;

        public WinFormProgressBar(ToolStripProgressBar bar, ToolStripStatusLabel label)
        {
            _label = label;
            _bar = bar;
            _bar.Maximum = 100;
            _bar.Value = 0;
        }

        public void Refresh()
        {
            Application.DoEvents();
        }

        public void RefreshWithText(string s)
        {
            _label.Text = s;
            Application.DoEvents();
        }


        #region IProgressBar Members

        public void SetMaximum(int max)
        {
            _bar.Maximum = max;
        }

        public int GetMaximum()
        {
            return _bar.Maximum;
        }

        public void SetValue(int value)
        {
            _bar.Value = value;
        }

        public int GetValue()
        {
            return _bar.Value;
        }

        #endregion
    }
}
